Skip to content

1059 update designs for multiple endpoints#1173

Merged
gibahjoe merged 13 commits intomainfrom
1059-update-designs-for-multiple-endpoints
Apr 8, 2026
Merged

1059 update designs for multiple endpoints#1173
gibahjoe merged 13 commits intomainfrom
1059-update-designs-for-multiple-endpoints

Conversation

@gibahjoe
Copy link
Copy Markdown
Contributor

@gibahjoe gibahjoe commented Apr 7, 2026

Description

Implements issue #1059 by updating the dataset overview endpoint presentation to the GOV.UK summary card pattern for multiple endpoints, with clearer status/error visibility.

What changed

  • Added an Active endpoints section with endpoint count text.
  • Rendered each active endpoint as its own summary card titled Endpoint N.
  • Included endpoint fields per design intent:
    • Endpoint URL
    • Webpage URL (source documentation URL)
    • Date added
    • Endpoint last accessed
    • Endpoint last updated
  • Added/updated error presentation for endpoint access errors, with highlighted styling and clearer messaging.
  • Kept Dataset details behaviour aligned with feedback (no extra per-endpoint licence rows inside cards, no edit/retire actions).

Acceptance criteria mapping

  • Summary table/card component used for endpoints:
  • Only active endpoints displayed:
  • Endpoints ordered so newest appears first, with endpoint numbering shown in cards:
  • HTTP endpoint access errors surfaced and highlighted:

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

  1. Open a dataset overview page that has multiple active endpoints.
  2. Confirm Active endpoints heading and count text appears (for example: You have X endpoints we are currently checking for data).
  3. Confirm each endpoint is shown as a separate summary card with title Endpoint N.
  4. Confirm cards contain:
    • Endpoint URL
    • Webpage URL (or Documentation URL missing message)
    • Date added
    • Endpoint last accessed
    • Endpoint last updated
  5. Confirm newest endpoint is shown first and numbering matches that order.
  6. Confirm endpoints with access errors show highlighted error messaging in the card.
  7. Confirm Dataset details section still renders correctly.

Before

Screenshot 2026-04-07 at 13 58 41

After

Screenshot 2026-04-07 at 14 16 57

Added/updated tests?

We encourage you to keep the code coverage percentage at 80% and above.

  • Yes
  • No, and this is why: Please replace this line with details on why tests have not been included
  • I need help with writing tests

QA sign off

  • Code has been checked and approved
  • Design has been checked and approved
  • Product and business logic has been checked and proved

[optional] Are there any post-deployment tasks we need to perform?

None expected.

[optional] Are there any dependencies on other PRs or Work?

No direct dependencies identified.

If you want, I can also generate a shorter version of this for a cleaner PR body and a separate reviewer checklist comment you can post after opening the PR.

Summary by CodeRabbit

  • New Features

    • Dataset overview pages now include an "Active endpoints" section with per-endpoint cards showing Endpoint URL, Webpage URL (or missing-documentation note), date added, Endpoint last accessed and Endpoint last updated; endpoints are ordered descending and titled "Endpoint {index}".
    • Dataset summary label changed from "Number of records" to "Number of records supplied".
  • Tests

    • Acceptance and unit tests updated to assert the new Active endpoints section and adjusted summary/card expectations.
  • Chores

    • .gitignore now ignores the .history directory and ends with a trailing newline.

@gibahjoe gibahjoe linked an issue Apr 7, 2026 that may be closed by this pull request
4 tasks
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)

Walkthrough

Reworked the dataset overview to render active endpoints as ordered summary cards (with URL, documentation, dates and error messages), changed a dataset label, adjusted conditional rendering for authority, updated tests to expect the new "Active endpoints" section, and added .history to .gitignore.

Changes

Cohort / File(s) Summary
Configuration
​.gitignore
Added .history to ignored paths and ensured trailing newline.
Template / view
src/views/organisations/dataset-overview.html
Replaced lastAccessedInfo macro with endpointUrlWithError; endpoints are built into per-endpoint endpointSummaryCards and rendered in a new "Active endpoints" section (Endpoint URL, Webpage URL/documentation error row, Date added, Endpoint last accessed, Endpoint last updated); dataset label changed to “Number of records supplied”; endpoint/licence content omitted when authority === 'some'; endpoint titles indexed descending (Endpoint {n}).
Acceptance tests
test/acceptance/dataset_overview.test.js
Added assertion for "Active endpoints" section and relaxed summary list count expectation to allow additional items.
Unit tests
test/unit/views/organisations/dataset-overview.test.js
Removed brittle fixed-index assertions from dataset details; added test asserting active endpoint cards render in descending order with titles, URLs, docs, dates and error code; updated endpoint fixture dates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • GeorgeGoodall-GovUk
  • eveleighoj

Poem

🐇 I hopped through templates, cards in a row,
Numbered endpoints, newest first they show.
URLs and docs, dates snug and bright,
Errors peep out, then vanish from sight.
A little rabbit applauds this tidy flow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references issue #1059 and accurately describes the main change: updating designs for multiple endpoints display.
Linked Issues check ✅ Passed All acceptance criteria from issue #1059 are met: summary cards used for endpoints, only active endpoints displayed, endpoints ordered newest-first with numbering, and HTTP errors highlighted.
Out of Scope Changes check ✅ Passed All changes directly support issue #1059 objectives. The .gitignore update is a minor maintenance change unrelated to the issue but does not interfere with main objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1059-update-designs-for-multiple-endpoints

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 65.95% 6885 / 10439
🔵 Statements 65.95% 6885 / 10439
🔵 Functions 63.53% 277 / 436
🔵 Branches 77.95% 916 / 1175
File CoverageNo changed files found.
Generated in workflow #1384 for commit e9ec1aa by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/unit/views/organisations/dataset-overview.test.js (1)

40-41: ⚠️ Potential issue | 🟡 Minor

Test data contains invalid dates.

'2024-19-19' is not a valid date (month 19 doesn't exist). This was likely intended to be something like '2024-09-19'. The govukDateTime filter may produce unexpected output when formatting these invalid dates, potentially masking issues or causing unreliable test behaviour.

💚 Suggested fix
         {
           name: 'endpoint 2',
           endpoint: 'BAR',
           endpoint_url: 'http://endpoint2.co.uk',
-          lastAccessed: '2024-19-19',
-          lastUpdated: '2024-19-19',
+          lastAccessed: '2024-09-19',
+          lastUpdated: '2024-09-19',
           entryDate: '2024-12-12',
           error: {
             code: 404,
             exception: ''
           }
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/unit/views/organisations/dataset-overview.test.js` around lines 40 - 41,
The test fixture in dataset-overview.test.js contains invalid date strings for
the fields lastAccessed and lastUpdated ('2024-19-19'); update these values to
valid ISO-like dates (e.g. '2024-09-19' or another correct YYYY-MM-DD) so the
govukDateTime filter and any date formatting in the test exercise real, valid
dates; locate the object/fixture that sets lastAccessed and lastUpdated in the
test and replace the invalid month with a valid month value.
🧹 Nitpick comments (2)
src/views/organisations/dataset-overview.html (2)

137-148: Consider simplifying the falsy check for documentation_url.

The current check is not defined or endpoint.documentation_url == "" may not catch null values. In Nunjucks, you can use a simpler falsy check:

♻️ Suggested simplification
-    {% if endpoint.documentation_url is not defined or endpoint.documentation_url == "" %}
+    {% if not endpoint.documentation_url %}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/organisations/dataset-overview.html` around lines 137 - 148, The
template currently checks "endpoint.documentation_url is not defined or
endpoint.documentation_url == ''" which misses null/other falsy values; replace
that conditional with a single falsy check (e.g., "if not
endpoint.documentation_url") to cover undefined, null, and empty string, leaving
the endpointRows.push usage and the else branch that builds the anchor (using
urlStyle and endpoint.documentation_url) unchanged so the error markup and link
rendering remain identical.

13-20: Macro always renders error message regardless of error state.

The endpointUrlInfo macro unconditionally renders the error message block (lines 16-18). While current usage at line 127 is guarded by {% if endpoint.error %}, the macro name doesn't indicate it's error-specific, which could lead to misuse if called elsewhere.

Consider either:

  1. Renaming to endpointUrlWithError to clarify intent, or
  2. Adding a guard within the macro
♻️ Option 2: Add guard within macro
 {% macro endpointUrlInfo(organisation, dataset, endpoint) %}
   <a style="{{ urlStyle}}" href="{{endpoint.endpoint_url}}">{{endpoint.endpoint_url}}</a>
-
-  <p class="govuk-error-message">
-   {{ endpointErrorMessage(endpoint) }}
-  </p>
-
+  {% if endpoint.error %}
+    <p class="govuk-error-message">
+      {{ endpointErrorMessage(endpoint) }}
+    </p>
+  {% endif %}
 {% endmacro %}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/organisations/dataset-overview.html` around lines 13 - 20, The
macro endpointUrlInfo currently always renders the error block; update the macro
so the error message paragraph (the call to endpointErrorMessage(endpoint)) is
only rendered when endpoint.error is truthy by wrapping that <p> block with a
conditional (e.g., {% if endpoint.error %} ... {% endif %}); keep the macro name
or optionally rename to endpointUrlWithError if you prefer an explicit name, but
ensure endpointUrlInfo only outputs the error markup when endpoint.error is set.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/views/organisations/dataset-overview.html`:
- Around line 154-157: The template is inconsistent: endpoint.lastAccessed is
not null-guarded before passing to the govukDateTime filter like entryDate and
lastUpdated; update the push into endpointRows so that value.text uses the same
guard pattern (e.g., endpoint.lastAccessed and endpoint.lastAccessed |
govukDateTime) to avoid calling govukDateTime with undefined while leaving
endpointRows, endpoint.lastAccessed and govukDateTime referenced exactly as in
the diff.

---

Outside diff comments:
In `@test/unit/views/organisations/dataset-overview.test.js`:
- Around line 40-41: The test fixture in dataset-overview.test.js contains
invalid date strings for the fields lastAccessed and lastUpdated ('2024-19-19');
update these values to valid ISO-like dates (e.g. '2024-09-19' or another
correct YYYY-MM-DD) so the govukDateTime filter and any date formatting in the
test exercise real, valid dates; locate the object/fixture that sets
lastAccessed and lastUpdated in the test and replace the invalid month with a
valid month value.

---

Nitpick comments:
In `@src/views/organisations/dataset-overview.html`:
- Around line 137-148: The template currently checks "endpoint.documentation_url
is not defined or endpoint.documentation_url == ''" which misses null/other
falsy values; replace that conditional with a single falsy check (e.g., "if not
endpoint.documentation_url") to cover undefined, null, and empty string, leaving
the endpointRows.push usage and the else branch that builds the anchor (using
urlStyle and endpoint.documentation_url) unchanged so the error markup and link
rendering remain identical.
- Around line 13-20: The macro endpointUrlInfo currently always renders the
error block; update the macro so the error message paragraph (the call to
endpointErrorMessage(endpoint)) is only rendered when endpoint.error is truthy
by wrapping that <p> block with a conditional (e.g., {% if endpoint.error %} ...
{% endif %}); keep the macro name or optionally rename to endpointUrlWithError
if you prefer an explicit name, but ensure endpointUrlInfo only outputs the
error markup when endpoint.error is set.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fc18acc4-9ea0-4837-879b-eeb040ad276c

📥 Commits

Reviewing files that changed from the base of the PR and between 2b0d00f and 579a746.

📒 Files selected for processing (4)
  • .gitignore
  • src/views/organisations/dataset-overview.html
  • test/acceptance/dataset_overview.test.js
  • test/unit/views/organisations/dataset-overview.test.js

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 2 file(s) based on 1 unresolved review comment.

Files modified:

  • package-lock.json
  • src/views/organisations/dataset-overview.html

Commit: 6303b407512c62b2383494dcda458bd0b21b2720

The changes have been pushed to the 1059-update-designs-for-multiple-endpoints branch.

Time taken: 3m 22s

gibahjoe and others added 2 commits April 7, 2026 15:58
Fixed 2 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/views/organisations/dataset-overview.html`:
- Around line 131-146: Replace the unsafe string concatenation with Nunjucks
variable capture and escaping: use a truthy check (e.g., "if not
endpoint.documentation_url" and "if not endpoint.endpoint_url") so null and
empty values are handled, then capture escaped values into locals (e.g., set
doc_url = endpoint.documentation_url | default('') | e and set ep_url =
endpoint.endpoint_url | default('') | e) and use those captured variables for
both href and link text when pushing into endpointRows; also ensure urlStyle is
not injected from user input or is escaped before use.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 49e43e75-4d31-47cd-9688-c4290b6525ff

📥 Commits

Reviewing files that changed from the base of the PR and between 579a746 and 6303b40.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/views/organisations/dataset-overview.html

@pooleycodes pooleycodes self-requested a review April 8, 2026 08:16
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/views/organisations/dataset-overview.html (1)

13-20: Minor: Inconsistent spacing in template variable syntax.

The spacing within Nunjucks template variables is inconsistent. Line 14 uses {{ urlStyle}} and {{endpoint.endpoint_url}} whilst other parts of the template use consistent spacing like {{ urlStyle }}.

This is a minor style nit but worth keeping consistent for readability.

♻️ Suggested fix for consistency
 {% macro endpointUrlWithError(organisation, dataset, endpoint) %}
-  <a style="{{ urlStyle}}" href="{{endpoint.endpoint_url}}">{{endpoint.endpoint_url}}</a>
+  <a style="{{ urlStyle }}" href="{{ endpoint.endpoint_url }}">{{ endpoint.endpoint_url }}</a>
 
   <p class="govuk-error-message">
    {{ endpointErrorMessage(endpoint) }}
   </p>
 
 {% endmacro %}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/views/organisations/dataset-overview.html` around lines 13 - 20, The
template macro endpointUrlWithError has inconsistent Nunjucks variable spacing;
update all mustache tags inside that macro to use consistent spacing (e.g., "{{
urlStyle }}", "{{ endpoint.endpoint_url }}", "{{ endpointErrorMessage(endpoint)
}}") so every template variable follows the same "{{ var }}" style—edit the
occurrences of urlStyle, endpoint.endpoint_url, and endpointErrorMessage within
the endpointUrlWithError macro to apply the spaced format.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/views/organisations/dataset-overview.html`:
- Around line 13-20: The template macro endpointUrlWithError has inconsistent
Nunjucks variable spacing; update all mustache tags inside that macro to use
consistent spacing (e.g., "{{ urlStyle }}", "{{ endpoint.endpoint_url }}", "{{
endpointErrorMessage(endpoint) }}") so every template variable follows the same
"{{ var }}" style—edit the occurrences of urlStyle, endpoint.endpoint_url, and
endpointErrorMessage within the endpointUrlWithError macro to apply the spaced
format.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 77db506b-20f7-4f3f-9e03-dbcedd711fb2

📥 Commits

Reviewing files that changed from the base of the PR and between 725c1ca and 80451c3.

📒 Files selected for processing (1)
  • src/views/organisations/dataset-overview.html

@gibahjoe gibahjoe merged commit a2efd66 into main Apr 8, 2026
5 checks passed
@gibahjoe gibahjoe deleted the 1059-update-designs-for-multiple-endpoints branch April 8, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update designs for multiple endpoints

2 participants